package com.work.yshop.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;

import androidx.appcompat.app.AppCompatActivity;

import com.work.yshop.R;
import com.work.yshop.databinding.ActivitySplashBinding;

/**
 * 启动页活动
 */
public class SplashActivity extends AppCompatActivity {

    private ActivitySplashBinding binding;
    
    // 延迟时间
    private static final long SPLASH_DELAY = 2000;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = ActivitySplashBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());
        
        // 延迟跳转到登录页
        new Handler(Looper.getMainLooper()).postDelayed(this::navigateToLogin, SPLASH_DELAY);
    }
    
    /**
     * 跳转到登录页
     */
    private void navigateToLogin() {
        Intent intent = new Intent(this, LoginActivity.class);
        startActivity(intent);
        finish();
    }
} 